<?php
require "admin/config/mysql.php";

class articleModel
{ 
   public static function getArticlecontent($id)
	 {	 	 
          $pdo = mysqlPdo::getPdoConnect();
		  $re = $pdo -> query("select * from article_content  where id = $id");
		  $res = $re -> fetchAll(PDO::FETCH_ASSOC);  
          return $res;
 	 }


   public static function nextarticle($kid,$id)
     {
	      $pdo = mysqlPdo::getPdoConnect();
	      $re3 = $pdo -> query("select id from article_content where kid = $kid and id > $id  limit 1");
		  $res3 = $re3 -> fetch(PDO::FETCH_ASSOC);
		  $next_id = $res3["id"];
		  $next = array(
	        'next_id'=>$next_id,
	        'res3' => $res3
		  );
		  return $next;
   }


   public static function prearticle($kid,$id)
    {
      $pdo = mysqlPdo::getPdoConnect();
      $re4 = $pdo -> query("select id from article_content where kid = $kid and id < $id  order by id desc limit 1");
	  $res4 = $re4 -> fetch(PDO::FETCH_ASSOC);
	  $prv_id = $res4["id"];
	  $pre = array(
        'pre_id'=>$prv_id,
        'res4' => $res4
	  );		   
       return $pre;
    }


   public static function getMessage($id)
    {
       $pdo = mysqlPdo::getPdoConnect();
	   $tr3 = $pdo -> query("select * from message where kid=$id and flag=1 ");
	   $str3= $tr3 -> fetchALL(PDO::FETCH_ASSOC);
	   return $str3;
   }
 







}